package com.gy.edu.home.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.gy.edu.R;

/**
 * Created by 高岳 on 2016/12/22.
 * Describe:
 */
public class ClassCatalogAdapter extends BaseAdapter {

    private Context context;
    private String[] datas = new String[]{"","教案_汽车电气设备基础","课件_汽车电气设备基本知识","课件_汽车电路识图基础",
            "动画_汽车电气设备的组成","动画_导线标记",    "动画_导线的功用","动画_熔断器的功用","动画_继电器功用",
            "动画_继电器类型","图片_示波仪","图片_熔断器常见外形","图片_汽车连接器常见外形","视频_数字万用表的使用",
            "视频_电烙铁的使用","工作页_汽车电气设备基础","仿真_常开式继电器3D结构展示","试题_汽车电气设备基础",
            "教案_起动型铅蓄电池的结构及电池型号","教案_电解液的配制及蓄电池的充电"};

    public ClassCatalogAdapter(Context context){
        this.context = context;
    }

    @Override
    public int getCount() {
        return 1;
    }

    @Override
    public Object getItem(int position) {
        return null;
    }

    @Override
    public long getItemId(int position) {
        return 0;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        convertView = View.inflate(context, R.layout.adapter_class_catalog,null);
        ImageView imgLine = (ImageView) convertView.findViewById(R.id.adapter_class_catalog_img_line);
        ImageView imgFlag = (ImageView) convertView.findViewById(R.id.adapter_class_catalog_img_flag);
        ImageView imgMore = (ImageView) convertView.findViewById(R.id.adapter_class_catalog_img_more);
        TextView tvTitle = (TextView) convertView.findViewById(R.id.adapter_class_catalog_tv_title);
        TextView tvContent = (TextView) convertView.findViewById(R.id.adapter_class_catalog_tv_content);
//        LinearLayout llContent = (LinearLayout) convertView.findViewById(R.id.adapter_class_catalog_ll_content);
//        llContent.setVisibility(View.VISIBLE);
//        imgMore.setVisibility(View.VISIBLE);
//        tvContent.setText(datas[position]+"");
//        if(position == 0){
//            imgLine.setBackgroundResource(R.drawable.link_dir_bottom_one);
//            tvTitle.setVisibility(View.VISIBLE);
//            tvContent.setVisibility(View.GONE);
//            llContent.setVisibility(View.GONE);
//            imgMore.setVisibility(View.GONE);
//            tvTitle.setText("项目一汽车电器设备基础");
//        } else if(position == 10){
//            imgLine.setBackgroundResource(R.drawable.link_dir_one);
//            tvTitle.setVisibility(View.VISIBLE);
//            tvContent.setVisibility(View.GONE);
//            llContent.setVisibility(View.GONE);
//            imgMore.setVisibility(View.GONE);
//            tvTitle.setText("项目二蓄电池");
//        } else if(position == 19){
//            imgLine.setBackgroundResource(R.drawable.last_index);
//            tvTitle.setVisibility(View.GONE);
//            tvContent.setVisibility(View.VISIBLE);
//        } else {
//            imgLine.setBackgroundResource(R.drawable.link_dir);
//            tvTitle.setVisibility(View.GONE);
//            tvContent.setVisibility(View.VISIBLE);
//        }
//        if(position % 6 == 0){
//            imgFlag.setImageResource(R.mipmap.icon_word);
//        } else  if(position % 6 == 1){
//            imgFlag.setImageResource(R.mipmap.icon_video);
//        }else  if(position % 6 == 2){
//            imgFlag.setImageResource(R.mipmap.icon_pdf);
//        }else  if(position % 6 == 3){
//            imgFlag.setImageResource(R.mipmap.icon_fla);
//        }else  if(position % 6 == 4){
//            imgFlag.setImageResource(R.mipmap.icon_ppt);
//        }else  if(position % 6 == 5){
//            imgFlag.setImageResource(R.mipmap.icon_unity);
//        }
        return convertView;
    }
}
